demo_list = [1,2,3]
print(demo_list)
print('demo_list id %x'% id(demo_list))
demo_list.append(10)
print(demo_list)
print('改变后demo_list id %x'% id(demo_list))

#可变数据类型储存的数据空间地址,使用方法地址不变

demo_list = [1,2,3,4]  #但是赋值就会改变
print('改变后demo_list id %x'% id(demo_list))

print('-'*50)

demo_dict = {'name':'小明'}
print('定义字典后的内存地址%d'% id(demo_dict))

demo_dict['name'] = '老王'
print('修改后数据的内存地址%d'%id(demo_dict))


"""
不可变数据类型没有方法，想要改变必须赋值，所以内存会改变
"""

def change_list(my_list):
    my_list = [2,3,4]

print(demo_list)
change_list(demo_list)
print(demo_list)